
import fr.epsi.montpellier.ejbmodulecrm.heavy.facade.FacadeClientBeanLocal;
import fr.epsi.montpellier.ejbmodulecrm.heavy.model.Client;
import javax.ejb.EJB;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Clément
 */
public class RechercheManagedBean {

    @EJB
    private FacadeClientBeanLocal facadeClient;
    
    /**
     * Creates a new instance of RechercheManagedBean
     */
    public RechercheManagedBean() {
    }
    
    private String telephone;

    /**
     * @return the telephone
     */
    public String getTelephone() {
        return telephone;
    }

    /**
     * @param telephone the telephone to set
     */
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
    
    public String valider() {
       if (getFacadeClient() != null) {
            Client cli = getFacadeClient().rechercherClientParTel(telephone);
            if (cli != null) {
                return "trouve";
            } else {
                return "trouvepas";
            }
       }
       return "";
    }

    /**
     * @return the facadeClient
     */
    public FacadeClientBeanLocal getFacadeClient() {
        return facadeClient;
    }

    /**
     * @param facadeClient the facadeClient to set
     */
    public void setFacadeClient(FacadeClientBeanLocal facadeClient) {
        this.facadeClient = facadeClient;
    }
}
